<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
//微信扫码登录
Route::group('scan', function () {
	Route::any('index', 'index/index/index');
	Route::any('register', 'index/index/register');
	Route::any('check', 'index/index/check');
	Route::any('/login_success/:mt_id', 'index/index/login_success');
});
//api接口
Route::group('api', function () {
	Route::group('user', function () {
		Route::any('center', 'api/user/center');
		Route::any('test', 'api/user/test');
	})->middleware('login');
	Route::group('user', function () {
		Route::post('login', 'api/user/login');
		Route::any('register', 'api/user/register');
	});
	Route::group('public', function () {
		Route::post('sendCode', 'api/Common/sendCode');
	});
})->middleware('check');

//es搜索
Route::get('search', function () {
	$data = ( new \app\hander\ElasticsearchHander() )->search('描述', [ 'page' => 1, 'pagesize' => 20 ], [
		'_score' => 'asc',
		'id'     => 'asc',
	]);
	echo '<pre>';
	print_r($data['hits']);
});